from flask import Flask
from flask_cors import CORS
from flask_jwt_extended import JWTManager

from apis.table import table
from apis.user import user


def create_app():
    app = Flask(__name__)
    CORS(app)
    app.config.from_object('apis.secure')
    reg_blueprint(app)
    JWTManager(app)
    return app


def reg_blueprint(app):
    app.register_blueprint(user, url_prefix='/user')
    app.register_blueprint(table, url_prefix='/article')
